import useLocaleStore from '@/stores/locale'
import storage from './storage'
// import {
//     zhCn,
//     zhTw,
//     enUs,
//     jpan
// } from '@/locale/index'
const LocaleUtils = {
    localeList: ['zh-cn', 'zh-tw', 'en-us', 'en-gb', 'jpan'],
    getLocaleLabel: () => {
        const locale = useLocaleStore()
        return locale.getLocaleLabel()
    },
    setLocale: (label: string) => {
        const localeList = ['zh-cn', 'zh-tw', 'en-us', 'en-gb', 'jpan']
        if (localeList.indexOf(label) > -1) {
            storage.set('locale', label)
            const locale = useLocaleStore()
            locale.setLocale(label)
        }
    },
    getLocale: () => {
        // const locale = useLocaleStore()
        // switch (locale.getLocaleLabel()) {
        //     case 'zh-cn':
        //         return zhCn
        //         break
        //     case 'zh-tw':
        //         return zhTw
        //         break;
        //     case 'en-us':
        //         return enUs
        //         break;
        //     case 'jpan':
        //         return jpan
        //         break;
        //     default:
        //         throw Error("locale doesn't exist!")
        //         break
        // }
    }

}
export default LocaleUtils;